package com.jianyun.jyzs.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "tb_user")
public class User extends Response {

    private static final long serialVersionUID = 20150523111122L;

    public final static String ID_FIELD_NAME = "id";//这里用一个常量来设置属性的名字，这样我们在中就可以直接使用该名字
    public final static String TABLE_NAME = "tb_user";

    @DatabaseField(generatedId = true, columnName = ID_FIELD_NAME)
    private Integer id; //主键
    @DatabaseField
    private String serverUserId;// 服务端用户ID
    @DatabaseField
    private String enterpriseCode; //企业号
    @DatabaseField
    private String name; // 账号
    @DatabaseField
    private String password; // 密码
    @DatabaseField
    private String nameZh; // 用户名称
    @DatabaseField
    private String email; // 邮箱
    @DatabaseField
    private String phoneNum;//手机号
    @DatabaseField
    private String company;//所在单位
    @DatabaseField
    private String department;//所在部门
    @DatabaseField
    private String sex;//性别
    @DatabaseField
    private String localIconPath; // 本地头像URL
    @DatabaseField
    private String serverIconPath; // 服务头像URL
    @DatabaseField
    private int userType; // 用户类型,0:登录用户;1:朋友
    @DatabaseField
    private Integer loginState; // 登录状态
    @DatabaseField
    private String userId;//不同用户登录时,用来区分朋友(通讯录)的归属
    @DatabaseField
    private Integer isCommonContact;//是否常用联系人,1:是,0:否
    @DatabaseField
    private String orderRank;//序号
    @DatabaseField
    private String unitId;//部门ID
    //非数据库字段
    private String header;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getServerUserId() {
        return serverUserId;
    }

    public void setServerUserId(String serverUserId) {
        this.serverUserId = serverUserId;
    }

    public String getEnterpriseCode() {
        return enterpriseCode;
    }

    public void setEnterpriseCode(String enterpriseCode) {
        this.enterpriseCode = enterpriseCode;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNameZh() {
        return nameZh;
    }

    public void setNameZh(String nameZh) {
        this.nameZh = nameZh;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getLocalIconPath() {
        return localIconPath;
    }

    public void setLocalIconPath(String localIconPath) {
        this.localIconPath = localIconPath;
    }

    public String getServerIconPath() {
        return serverIconPath;
    }

    public void setServerIconPath(String serverIconPath) {
        this.serverIconPath = serverIconPath;
    }

    public int getUserType() {
        return userType;
    }

    public void setUserType(int userType) {
        this.userType = userType;
    }

    public Integer getLoginState() {
        return loginState;
    }

    public void setLoginState(Integer loginState) {
        this.loginState = loginState;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Integer getIsCommonContact() {
        return isCommonContact;
    }

    public void setIsCommonContact(Integer isCommonContact) {
        this.isCommonContact = isCommonContact;
    }

    public String getOrderRank() {
        return orderRank;
    }

    public void setOrderRank(String orderRank) {
        this.orderRank = orderRank;
    }

    public String getUnitId() {
        return unitId;
    }

    public void setUnitId(String unitId) {
        this.unitId = unitId;
    }

    public String getHeader() {
        return header;
    }

    public void setHeader(String header) {
        this.header = header;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", serverUserId='" + serverUserId + '\'' +
                ", enterpriseCode='" + enterpriseCode + '\'' +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", nameZh='" + nameZh + '\'' +
                ", email='" + email + '\'' +
                ", phoneNum='" + phoneNum + '\'' +
                ", company='" + company + '\'' +
                ", department='" + department + '\'' +
                ", sex='" + sex + '\'' +
                ", localIconPath='" + localIconPath + '\'' +
                ", serverIconPath='" + serverIconPath + '\'' +
                ", userType=" + userType +
                ", loginState=" + loginState +
                ", userId='" + userId + '\'' +
                ", isCommonContact=" + isCommonContact +
                ", orderRank='" + orderRank + '\'' +
                ", unitId='" + unitId + '\'' +
                '}';
    }


    /*//非数据库字段
	private String header;

	public User() {
		//提供无参构造函数，这样查询的时候可以返回查询出来的对象
	}

	public User(Integer id, String serverUserId, String enterpriseCode, String name, String password,
                String nameZh, String email, String phoneNum, String company,
                String department, String sex, String localIconPath, String serverIconPath, int userType,
                Integer loginState, String userId, Integer isCommonContact) {
		super();
		this.id = id;
		this.serverUserId = serverUserId;
		this.enterpriseCode = enterpriseCode;
		this.name = name;
		this.password = password;
		this.nameZh = nameZh;
		this.email = email;
		this.phoneNum = phoneNum;
		this.company = company;
		this.department = department;
		this.sex = sex;
		this.localIconPath = localIconPath;
		this.serverIconPath = serverIconPath;
		this.userType = userType;
		this.loginState = loginState;
		this.userId = userId;
		this.isCommonContact = isCommonContact;
	}

	protected User(Parcel in) {
//		if (in.readByte() == 0) {
//			id = null;
//		} else {
//			id = in.readInt();
//		}
		serverUserId = in.readString();
		//enterpriseCode = in.readString();
		name = in.readString();
//		password = in.readString();
//		nameZh = in.readString();
//		email = in.readString();
		phoneNum = in.readString();
		//company = in.readString();
		department = in.readString();
//		sex = in.readString();
//		localIconPath = in.readString();
		serverIconPath = in.readString();
//		userType = in.readInt();
//		if (in.readByte() == 0) {
//			loginState = null;
//		} else {
//			loginState = in.readInt();
//		}
//		userId = in.readString();
//		if (in.readByte() == 0) {
//			isCommonContact = null;
//		} else {
//			isCommonContact = in.readInt();
//		}
//		header = in.readString();
	}

	public static final Creator<User> CREATOR = new Creator<User>() {
		@Override
		public User createFromParcel(Parcel in) {
			return new User(in);
		}

		@Override
		public User[] newArray(int size) {
			return new User[size];
		}
	};

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getIsCommonContact() {
		return isCommonContact;
	}

	public void setIsCommonContact(Integer isCommonContact) {
		this.isCommonContact = isCommonContact;
	}

	public String getServerUserId() {
		return serverUserId;
	}

	public void setServerUserId(String serverUserId) {
		this.serverUserId = serverUserId;
	}

	public String getEnterpriseCode() {
		return enterpriseCode;
	}

	public void setEnterpriseCode(String enterpriseCode) {
		this.enterpriseCode = enterpriseCode;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getNameZh() {
		return nameZh;
	}

	public void setNameZh(String nameZh) {
		this.nameZh = nameZh;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhoneNum() {
		return phoneNum;
	}

	public void setPhoneNum(String phoneNum) {
		this.phoneNum = phoneNum;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getLocalIconPath() {
		return localIconPath;
	}

	public void setLocalIconPath(String localIconPath) {
		this.localIconPath = localIconPath;
	}

	public String getServerIconPath() {
		return serverIconPath;
	}

	public void setServerIconPath(String serverIconPath) {
		this.serverIconPath = serverIconPath;
	}

	public int getUserType() {
		return userType;
	}

	public void setUserType(int userType) {
		this.userType = userType;
	}

	public Integer getLoginState() {
		return loginState;
	}

	public void setLoginState(Integer loginState) {
		this.loginState = loginState;
	}

	public String getHeader() {
		return header;
	}

	public void setHeader(String header) {
		this.header = header;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@Override
	public String toString() {
		return "User{" +
				"id=" + id +
				", serverUserId='" + serverUserId + '\'' +
				", enterpriseCode='" + enterpriseCode + '\'' +
				", name='" + name + '\'' +
				", password='" + password + '\'' +
				", nameZh='" + nameZh + '\'' +
				", email='" + email + '\'' +
				", phoneNum='" + phoneNum + '\'' +
				", company='" + company + '\'' +
				", department='" + department + '\'' +
				", sex='" + sex + '\'' +
				", localIconPath='" + localIconPath + '\'' +
				", serverIconPath='" + serverIconPath + '\'' +
				", userType=" + userType +
				", loginState=" + loginState +
				", userId='" + userId + '\'' +
				", isCommonContact=" + isCommonContact +
				", header='" + header + '\'' +
				'}';
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
//		if (this.userId!=null){
//
//		}
		dest.writeString(this.serverUserId );
		//dest.writeString(this.enterpriseCode);
		dest.writeString(this.name);
		//dest.writeString(this.password);
		//dest.writeString(this.nameZh);
		//dest.writeString(this.email);
		dest.writeString(this.phoneNum);
		//dest.writeString(this.company);
		dest.writeString(this.department);
		//dest.writeString(this.sex);
		//dest.writeString(this.localIconPath);
		dest.writeString(this.serverIconPath);
		//dest.writeString(this.userId);
		//dest.writeString(this.localIconPath);


	}*/
}